﻿using Manon.Admin.Web.Application;
using Manon.Admin.Web.Application.Dtos.Settings;
using Manon.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Manon.Admin.Web.Controllers
{
    public class ShieldingController : Controller
    {
        private readonly ISettingsService _settingsService;
        public ShieldingController(ISettingsService settingsService)
        {
            _settingsService = settingsService;
        }

        public IActionResult Index()
        {
            return View();
        }


        #region 屏蔽词相关
        /// <summary>
        /// 获取用户屏蔽词
        /// </summary>
        /// <returns></returns>
        [Authorize]
        [HttpGet]
        public async Task<GetGetSysShieldingOutput> GetSysShielding()
        { 
            var result = await _settingsService.GetSysShielding();

            return result;
        }

        /// <summary>
        /// 保存屏蔽词
        /// </summary>
        /// <param name="Input"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<Result> SaveSysShielding([FromBody] SaveSysShieldingInput Input)
        { 
            var result = await _settingsService.SaveSysShielding(Input);

            return result;
        }
        #endregion
    }
}
